/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.crystalrange.documents.service;

import com.googlecode.genericdao.search.Search;
import com.googlecode.genericdao.search.SearchResult;
import java.util.List;
import org.crystalrange.documents.model.Document;
import org.springframework.security.access.prepost.PreAuthorize;

/**
 *
 * @author Krzysiek
 */
public interface DocumentService {
    public Document create(String username);
       
    @PreAuthorize("hasRole('RIGHT_DOCUMENT_SAVE')")
    public boolean save(Document document);

    @PreAuthorize("hasRole('RIGHT_DOCUMENT_REMOVE')")
    public boolean remove(Document document);

    @PreAuthorize("hasRole('RIGHT_DOCUMENT_READ')")
    public Document find(Long id);

    @PreAuthorize("hasRole('RIGHT_DOCUMENT_READ')")
    public List<Document> findAll();
    
    @PreAuthorize("hasRole('RIGHT_DOCUMENT_READ')")
    public SearchResult<Document> searchAndCount(Search search);

    @PreAuthorize("hasRole('RIGHT_DOCUMENT_READ')")
    public List<Document> search(Search search);
    
    @PreAuthorize("hasRole('RIGHT_DOCUMENT_READ')")
    public Document searchUnique(Search search);
}
